<?php

/**
 * bbs actions.
 *
 * @package    sf.test
 * @subpackage bbs
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class defaultActions extends sfActions{
    /**
     * Executes index action
     *
     */
    public function executeIndex(){

        $guest_mode = ConfigPeer::checkGuestMode();
        $session_name = $this->getUser()->getAttribute("nickname", sfConfig::get("sf_session_name"));

        if($guest_mode == "n" && $session_name == null){

            $web_root = sfConfig::get("sf_web_root");
            $this->redirect($web_root."/login");
        }

        //$this->forward('default', 'module');
        return sfView::SUCCESS;
    }

    public function executeMemberlist(){

        $table_header = sfConfig::get("sf_table_header");
        $this->arr_job = sfConfig::get("app_job");

        $arr_list = MemberlistPeer::getListElements();
        $this->arr_lists = MyUtil::setTableHeader($arr_list, $table_header);

        return sfView::SUCCESS;
    }

    public function executeContent(){

        $content_id = $this->getRequestParameter("content_id");
        $table_header = sfConfig::get("sf_table_header");

        if(ContentsPeer::checkContent($content_id) == true){

            $this->arr_content = sfConfig::get("app_contents");

            $arr_delete_id = MemberlistPeer::getDeleteId();

            $arr_record = ContentsPeer::getRecords($content_id);

            $this->arr_cnt = count($arr_record[0]);

            $this->arr_lists = MyUtil::setTableHeader($arr_record, $table_header);
            $this->arr_th = ContentsPeer::getTableHeader($content_id);

            return sfView::SUCCESS;
        }
    }

    public function executePersonal(){

        $this->member_id = $this->getRequestParameter("id");
        $this->arr_job = sfConfig::get("app_job");
        $this->arr_content = sfConfig::get("app_contents");

        if(MemberlistPeer::checkMember($this->member_id)){

            $this->personal_data = MemberlistPeer::getPersonal($this->member_id);

            $this->arr_content_id = ContentsPeer::getContentId();


            return sfView::SUCCESS;
        }
    }
}




















